solving linear equations using matrix inversion method